<template>
  <div>
   <!-- 路由出口 -->
    <router-view></router-view>
  </div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
  name:'App',
  
})
</script>
<!-- <template>
  <div>
   <button @click="getUserInfo">获取用户信息</button>
  </div>
</template>
<script setup lang="ts">
import { onMounted } from 'vue';
// 引入自己封装的axios对象
import request from '@/utils/request';
//引入api中的登录方法
import { reqLogin } from './api/user';
// 定义变量存储token
let token = ''
onMounted(()=>{
  // request({
  //   url:'/login',
  //   method:'post',
  //   data:{
  //     username:'test1',
  //     password:'1234'
  //   }
  // }).then(response=>{
  //   token = response.data.token
  //   console.log(token);
  // })
  reqLogin({username:'admin',password:'admin'}).then(response=>{
    console.log(response.data);
    
  })
})
const getUserInfo = ()=>{
  request({
    url:'/user/info',
    method:'get',
    headers:{
      token
    }
  }).then(response=>{
    console.log('获取到的用户信息',response);
    
  })
}
</script>

<style scoped>

</style> -->